package com.soikc.kuaidiE.util;

import com.soikc.kuaidiE.bean.Courier;
import com.soikc.kuaidiE.bean.User;
import com.soikc.kuaidiE.bean.UserEax;

import javax.servlet.http.HttpSession;

public class UserUtil {
    public String getUserName(HttpSession session){
        UserEax wxUser = (UserEax) session.getAttribute("wxUser");
        return wxUser.getNickname();
    }
    public String getUserPhone(HttpSession session){
        UserEax wxUser = (UserEax) session.getAttribute("wxUser");
        return wxUser.getPhone();
    }
    public void setLoginCode(HttpSession session,String userPhone,String code){
        session.setAttribute(userPhone,code);
    }
    public String getLoginCode(HttpSession session,String userPhone){
        return (String) session.getAttribute(userPhone);
    }
    public void setWxUser(HttpSession session, User user){
        session.setAttribute("wxUser",user);
    }
    public UserEax getWxUser(HttpSession session){
        return (UserEax) session.getAttribute("wxUser");
    }
    public void setWxUser(HttpSession session, Courier courier){
        session.setAttribute("wxUser",courier);
    }
}
